<?php

namespace app\validate;

use share\validate\SceneValidate;

class LocalDeviceInfoValidate extends SceneValidate{
    protected $rule = [      
        'state' => 'require|min:16',
        'encode' => 'require|min:30',
        'userId' => 'require|length:30,64',
        'token' => 'require|length:30,64',
        'vendor' => 'require',
        'serialNo' => 'require|alphaNum|max:120',    
        'ip' => 'require|ip', 
        'port' => 'require|integer|>=:1|max:65535', 
        'nickName' =>  'require|length:1,100', 
        'userName' =>  'require|length:1,100', 
        'password' =>  'require|length:1,100', 
        'type' =>  'require|integer', 
        'serialNos' => 'array',  
    ];    

    protected $scene = [
        'list' => ['userId','vendor','state', 'encode', 'code', 'token'],
        'del' => ['userId','vendor','serialNos','state', 'encode', 'code', 'token'],
        'add' => ['userId','vendor','serialNo', 'ip', 'port','nickName','userName','password','type','state', 'encode', 'code', 'token'],
        'update' => ['userId','vendor','serialNo', 'ip', 'port','nickName','userName','password','type','state', 'encode', 'code', 'token'],
    ];
}